﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
#if UNITY_EDITOR

public static class MiaoGUILayout
{
    /// <summary>
    /// 回调需要填9个
    /// </summary>
    /// <param name="calls"></param>
    /// <param name="height"></param>
    /// <param name="width"></param>
    public static void NineGridButton(Action[] calls, int height = 50, int width = 50)
    {

        var h = GUILayout.Height(height);
        var w = GUILayout.Width(width);
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("左上", w, h))
        {
            calls[0].Invoke();
        }
        else if (GUILayout.Button("上", w, h))
        {
            calls[1].Invoke();
        }
        else if (GUILayout.Button("右上", w, h))
        {
            calls[2].Invoke();
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("左", w, h))
        {
            calls[3].Invoke();
        }
        else if (GUILayout.Button("中", w, h))//middle
        {
            calls[4].Invoke();
        }
        else if (GUILayout.Button("右", w, h))
        {
            calls[5].Invoke();
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("左下", w, h))
        {
            calls[6].Invoke();
        }
        else if (GUILayout.Button("下", w, h))
        {
            calls[7].Invoke();
        }
        else if (GUILayout.Button("右下", w, h))
        {
            calls[8].Invoke();
        }
        EditorGUILayout.EndVertical();
    }

}

#endif